package com.example.tms.mapper;

import com.example.tms.bean.UserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

/**
 * 用户角色信息
 */
@Repository
public interface UserRoleMapper extends JpaRepository<UserRole, String> {

    UserRole findByYhidAndJsid(String yhid, String jsid);

    @Transactional
    void deleteByYhidAndJsid(String yhid, String jsid);

    @Transactional
    void deleteByYhid(String yhid);

    //查询用户信息（jsid）
    @Query(value = "select * from user_role where jsid = ?1 ", nativeQuery = true)
    List<UserRole> findByJsid(String jsid);

}
